<?php $this->load->view('layout/header'); ?>

<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
    theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
function WebForm_OnSubmit() {
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;
return true;
}
//]]>
</script>
<form name="form1" method="post" action="<?php echo site_url('user/user_action').'/'.$info['userid'];?>" onsubmit="javascript:return WebForm_OnSubmit();" id="form1">
<div>
</div>
    <div id="container">
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table_form">
            <tr class="table_form_title">
                <td colspan="4">
                    <span id="lblTitle">添加</span>会员
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    <span class="star">*</span>会员账号：
                </td>
                <td>
                    <input name="username" value="<?php echo $info['username']?>" type="text" id="username" />
                    <span id="username_tips" style="color:Red;display:none;">不能为空</span>
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    <span class="star">*</span>会员密码：
                </td>
                <td>
                    <input name="userpass" value="" type="password" id="userpass" />
                    <?php if(isset($info['userpass'])){ ?>
                        <em>留空为不修改</em>
                    <?php }else{ ?>
                        <span id="userpass_tips" style="color:Red;display:none;">不能为空</span>
                    <?php } ?>
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    <span class="star">*</span>会员级别：
                </td>
                <td>
                    <select name="userrankid">
                        <option value="0">请选择</option>
                        <?php foreach($userrank as $val): ?>
                            <option value="<?php echo $val['userrankid']?>" <?php if($val['userrankid']==$info['userrankid']){echo 'selected';}?>><?php echo $val['userrankname']?></option>
                        <?php endforeach; ?>
                    </select>
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    <span class="star">*</span>姓名：
                </td>
                <td>
                    <input name="realname" value="<?php echo $info['realname']?>" type="text" id="realname" />
                    <span id="realname_tips" style="color:Red;display:none;">不能为空</span>
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    <span class="star">*</span>性别：
                </td>
                <td>
                    <input type="radio" name="sex" value="男" <?php if(!isset($info['sex'])|| $info['sex'] == '男'){echo 'checked'; }?>>男
                    <input type="radio" name="sex" value="女" <?php if(isset($info['sex']) && $info['sex'] == '女'){echo 'checked'; }?>>女
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    <span class="star">*</span>E-mail：
                </td>
                <td>
                    <input name="email" value="<?php echo $info['email']?>" type="text" id="email" />
                    <span id="email_tips" style="color:Red;display:none;">不能为空</span>
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    联系电话：
                </td>
                <td>
                    <input name="tel" value="<?php echo $info['tel']?>" type="text" />
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    手机：
                </td>
                <td>
                    <input name="mobile" value="<?php echo $info['mobile']?>" type="text" />
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    联系地址：
                </td>
                <td>
                    <input name="address" value="<?php echo $info['address']?>" type="text" />
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    <span class="star">*</span>积分：
                </td>
                <td>
                    <input name="point" value="<?php if($info['point']){echo $info['point'];}else{echo 0;}?>" type="text" />
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    备注：
                </td>
                <td>
                    <textarea nam="comment"><?php echo $info['comment']?></textarea>
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    是否审核：
                </td>
                <td>
                    <input type="radio" name="isaudit" value="1" <?php if(!isset($info['isaudit']) || $info['isaudit'] == 1){echo 'checked'; }?>>是
                    <input type="radio" name="isaudit" value="0" <?php if(isset($info['isaudit']) && $info['isaudit'] == 0){echo 'checked'; }?>>否
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    是否关闭：
                </td>
                <td>
                    <input type="radio" name="isclose" value="1" <?php if(isset($info['isclose']) && $info['isclose'] == '1'){echo 'checked'; }?>>是
                    <input type="radio" name="isclose" value="0" <?php if(!isset($info['isclose']) || $info['isclose'] == '0'){echo 'checked'; }?>>否
                </td>
            </tr>
            <tr class="table_form_btn">
                <td align="right">
                    &nbsp;
                </td>
                <td colspan="3">
                    <input type="submit" value="保存" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;btnSave&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" id="btnSave" />
                    <input type="button" value="返回" onclick="javascript:history.go(-1);" />
                    <span id="errMsg" style="color:Red;"></span>
                </td>
            </tr>
        </table>
    </div>
</form>
<script type="text/javascript">
$('#form1').submit(function() {
    var is = true;
    if (!input_tips($('#username'))) {
        is = false;
    }
    <?php if(!isset($info['userpass'])){ ?>
        if (!input_tips($('#userpass'))) {
            is = false;
        }
    <?php } ?>
    if (!input_tips($('#realname'))) {
        is = false;
    }
    if (!input_tips($('#email'))) {
        is = false;
    }
    return is;
});
</script>
</body>
</html>

